﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApp9
{
  public  enum CaiQuan
        {
            石头 = 1,
            剪刀,
            布
        }

     class PlayPepole
    {
        
        public string Name; //姓名
       
        public int STJDB { get; set; }//石头剪刀布
        public int FenShu { get; set; }//计算分数

        
        public PlayPepole(string name)
        {
            this.Name = name;
        }

        public PlayPepole() 
        {
        
        }

        public virtual void ChuQuan()//出拳虚方法
        {
            Console.WriteLine("请出拳: 1.石头 2.剪刀 3.布");
            
        } 


    }
    class NPC:PlayPepole //人机
    {
        public NPC(string name):base(name) 
        {
            this.Name = name;
        }

      public   static CaiQuan CaiQuan1;

        public override void ChuQuan()
        {
           
            Random r = new Random();   
            this.STJDB = r.Next(1,4);   //生成随机数1-3 & 赋值到Stjdb字段
            CaiQuan caiQuan = (CaiQuan)STJDB; //stjdb字段 转换caiQuan对应的枚举值
            Console.WriteLine("{0},出拳：{1}", Name, caiQuan);
            Console.WriteLine("=================================");


        }

    }
    class PlayYou:PlayPepole //玩家
    {

        public PlayYou(string name) : base(name)
        {
            this.Name = name;
        }
        public static CaiQuan caiQuan1;

        public override void ChuQuan()
        {
            base.ChuQuan(); //继承
            STJDB = int.Parse(Console.ReadLine());  //用stjdb字段接收输入的值
            CaiQuan caiQuan = (CaiQuan)STJDB;   //将stjdb转换为相对应的枚举值
            if (STJDB==1 || STJDB == 2 || STJDB == 3 )
            {
            Console.WriteLine("=================================");
            Console.WriteLine("{0},出拳：{1}", Name, caiQuan);   //最后输出
            }
            else
            {
                Console.WriteLine("请输入1-3范围内！");
                ChuQuan();
            }



        }
    }

}
